package com.cc.jdkjucdemo.optional.repository;

import com.cc.jdkjucdemo.optional.entity.User;

import java.util.Optional;

public class UserRepository {
    public Optional<User> findUserByName(String name) {
        if (name.equals("Peter")) {
            return Optional.of(new User("Peter", "Peter Parker"));
        } else {
            return Optional.empty();
        }
    }
}
